package com.ruoyi.life.service.manager;

import com.ruoyi.life.mapper.BuiRoomMapper;
import com.ruoyi.omp.api.domain.BuiRoom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BuiRoomManager {

    @Autowired
    private BuiRoomMapper buiRoomMapper;

    public void updateRoom(BuiRoom room){
        buiRoomMapper.updateBuiRoom(room);
    }

    public BuiRoom selectBuiRoomById(String id) {
        BuiRoom buiRoom = buiRoomMapper.selectBuiRoomById(id);
        return buiRoom;
    }

    public List<BuiRoom> selectBuiRoomList(BuiRoom buiRoom) {
        return buiRoomMapper.selectBuiRoomList(buiRoom);
    }

    public BuiRoom getBuiRoomByNum(String roomNum){
        BuiRoom query = new BuiRoom();
        query.setRoomNum(roomNum);
        List<BuiRoom> list =  this.selectBuiRoomList(query);
        if (list.size() > 0){
            return list.get(0);
        }else {
            return null;
        }
    }
}
